﻿using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZeroBug.EasyFlow.Core;

namespace EasyFlow
{
    public partial class FlowViewModel : ObservableObject
    {
        private readonly FlowBase _flow;
        [ObservableProperty]
        string _flowName;
        [ObservableProperty]
        bool _isFlowEnabled;
        [ObservableProperty]
        FlowStatus _status;
        public FlowViewModel(FlowBase flow)
        {
            this._flow = flow;
            this.FlowName = this._flow.Description;
            this.IsFlowEnabled = this._flow.IsEnabled;
            this.Status = this._flow.Status;
        }
        partial void OnIsFlowEnabledChanged(bool oldValue, bool newValue)
        {
            this._flow.IsEnabled = newValue;
        }
    }
}
